package com.test.leetcode;

import java.util.Stack;
class MinStack {

    private Stack<Integer> stack;
    private Stack<Integer> min;
    /** initialize your data structure here. */
    public MinStack() {
        stack  = new Stack();
        min = new Stack();
        min.push(Integer.MAX_VALUE);
    }
    public void push(int val) {
        stack.push(val);
        min.push(Math.min(min.peek(),val));
    }

    public void pop() {
        stack.pop();
        min.pop();
    }
    public int top() {
        return stack.peek();
    }

    public int getMin() {
        return min.peek();
    }
}